# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=opensbi-spacemit
# XXX: Updates require rebuilds of testin/u-boot-spacemit
pkgver=1.3.2.0_rc6
_realver=2.0rc6
pkgrel=0
pkgdesc="risc-v open source supervisor binary interface for spacemit"
url="https://gitee.com/bianbu-linux/opensbi"
arch="riscv64"
license="BSD-2-Clause"
options="!check" # no tests
makedepends="bash dtc python3 u-boot-tools"

source="$pkgname-$_realver.tar.gz::https://gitee.com/bianbu-linux/opensbi/repository/archive/v$_realver.tar.gz"
builddir=$srcdir/opensbi-v$_realver

build() {
	make PLATFORM=generic PLATFORM_DEFCONFIG=k1_defconfig
}

package() {
	mkdir -p "$pkgdir"/usr/share/$pkgname
	cp $builddir/build/platform/generic/firmware/*itb "$pkgdir"/usr/share/$pkgname
	cp $builddir/build/platform/generic/firmware/*bin "$pkgdir"/usr/share/$pkgname
}

sha512sums="
8e8e7511fceea1b27929ffd4ba41ae1ab47be2fcca19c2156538128bae1d206c72aa82ae593bf8cb0302be8d0d4bf7b21c19c609f73807c73eeed78503ac62f7  opensbi-spacemit-2.0rc6.tar.gz
"
